package com.example.demo.resp;

import lombok.Data;

@Data
public class RespMsg {

    private String respCode;

    private Object data;

    private String message;

    public RespMsg() {

    }

    public RespMsg(Object data) {
        this.data = data;
    }

    public RespMsg(String respCode, String message) {
        this.respCode = respCode;
        this.message = message;
    }

    public RespMsg(String respCode, String message, Object data) {
        this.respCode = respCode;
        this.message = message;
        this.data = data;
    }

    public static RespMsg success() {
        return new RespMsg(ResultCode.SUC_20000.getValue(), ResultCode.SUC_20000.getMessage(), null);
    }

    public static RespMsg success(Object data) {
        return new RespMsg(ResultCode.SUC_20000.getValue(), ResultCode.SUC_20000.getMessage(), data);
    }

    public static RespMsg error(String respCode, String message, Object data) {
        return new RespMsg(respCode, message, data);
    }

    public static RespMsg error(String message) {
        return new RespMsg(ResultCode.SYTEM_ERROR.getValue(), message);
    }

    public static RespMsg error(String respCode, String message) {
        return new RespMsg(respCode, message);
    }
}
